import moment from "moment";
import {Fragment} from "react";
import {Divider, Icon, Popconfirm} from "antd";
import React from "react";

export const advertColumns= [
  {
    title: '序号Id',
    dataIndex: 'categoryId',
  },
  {
    title: '名称',
    dataIndex: 'title',
  },
  {
    title: '缩略图',
    // dataIndex: 'status',
    dataIndex: "categorys"
  },
  {
    title: '链接',
    // dataIndex: 'status',
    dataIndex: "state"
  },
  {
    title: '点击次数',
    // dataIndex: 'status',
    dataIndex: "state"
  },
  {
    title: '上线时间',
    dataIndex: 'createTime',
    sorter: (a, b) => Date.parse(a.createTime) > Date.parse(b.createTime),
    render: val => <span>{moment(val).format('YYYY-MM-DD HH:mm:ss')}</span>,
  },
  {
    title: '操作',
    render: (text, item) => (
      <Fragment>
        <a onClick={() => this.advertEdit(item.id)}>编辑</a>
        <Divider type="vertical"/>
        <Popconfirm onConfirm={() => this.advertDelete(item.id)} title="确定删除该类别吗？"
                    icon={<Icon type="question-circle-o" style={{color: 'red'}}/>}>
          <a><Icon type="delete" style={{marginRight: 8}}/>删除</a>
        </Popconfirm>
        <Divider type="vertical"/>
        <a onClick={() => this.advertDetail(item.id)}>详情</a>
      </Fragment>
    ),
  },
];
